package com.zdxlz.fcmp.common.mybatis.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description：IPSec模板配置表【IPSec模式】枚举类
 * @Author： aman
 * @Date： 2025/2/8 10:48
 */
@Getter
@AllArgsConstructor
public enum EncapsulationModeEnum {
    TUNNEL_MODEL(1, "隧道模式"),
    TRANSMIT_MODEL(2, "传输模式"),
    ;
    @EnumValue
    private final Integer code;
    private final String name;

    public static EncapsulationModeEnum getByCode(Integer code) {
        for (EncapsulationModeEnum encapsulationModeEnum : EncapsulationModeEnum.values()) {
            if (encapsulationModeEnum.getCode() == code) {
                return encapsulationModeEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
